package com.lanp.springsd.config.database;

/**
 * @author jiangpeng
 * Created with IntelliJ IDEA.
 * Description:  动态数据源
 * Date: 2022-03-04 16:03:37
 */
//@Configuration
public class DynamicDataSourceConfig {


//    @Bean
//    @Primary
//    public DataSource primaryDataSource(@Autowired Map<String, DataSource> baseDataSourceMap) {
//        System.out.println("create routing datasource...");
//        Map<Object, Object> map = new HashMap<>();
//        //获取主数据源
//        DataSource masterDataSource = baseDataSourceMap.get(DataSourceCSV.masterDataSource);
//        //设置批量数据源
//        map.putAll(baseDataSourceMap);
//        RoutingDataSource routing = new RoutingDataSource();
//        routing.setTargetDataSources(map);
//        routing.setDefaultTargetDataSource(masterDataSource);
//        return routing;
//    }
}
